/*
	TaskContainer is an abstract class that implements a task container
*/
#ifndef TASKCONTAINER_H_
#define TASKCONTAINER_H_
#include "Statistics.h"
#include "Task.h"
#include <time.h>
#include <pthread.h>
#include <stdlib.h>

class TaskContainer {
public:
	virtual int getExitsStatistics(){return -1;} //overridden in complex containers
	virtual void put(Task* task, Statistics* stat) = 0;
	virtual Task* get(Statistics* stat) = 0;
	//virtual void setConsumersNum(int consumersNum) = 0;
	virtual void registerConsumer(int tid) = 0;
	virtual void registerProducer(int tid) = 0;
	virtual void init() = 0;  
	virtual ~TaskContainer(){};
	//virtual int getDebugInfo() = 0;  // debug only
	
	static unsigned int generateRandomSeed(){
		struct timespec* ts = new timespec();
		clock_gettime(_POSIX_MONOTONIC_CLOCK, ts);
		unsigned int seed = (unsigned int)ts->tv_nsec;
		delete ts;
		return seed;
	}
};

#endif /* TASKCONTAINER_H_ */
